<?php
  require '../../include/library.inc.php';
  require '../../include/admin_login.inc.php';
    
  $page_id = intval($_GET['page_id']);
  $publish = intval($_GET['publish']);
  
  if($page_id) {
    $sql = "UPDATE 
              pages
            SET
              published = $publish
            WHERE
              page_id = $page_id 
             ";
    query($sql);
  }
  
  redirect($_SERVER['HTTP_REFERER']);
?>